home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / cfrethrow.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1023 b   |  44 lines

  1. <!--- This example shows the use of CFRETHROW --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>CFRETHROW Example</TITLE>
  5. </HEAD>
  6.  
  7. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  8. <BODY  bgcolor="#FFFFD5">
  9.  
  10. <H3>CFRETHROW Example</H3>
  11.  
  12. <!--- Rethrow a DATABASE exception. --->
  13.  
  14. <cftry>
  15.     <cftry>
  16.         <CFQUERY NAME="GetMessages" DATASOURCE="cfsnippets">
  17.             SELECT   *
  18.             FROM     Messages
  19.         </CFQUERY>
  20.     <cfcatch type="DATABASE">
  21.         <!----------------------------------------------------------- 
  22.         If the database signalled a 50555 error, we can ignore it, 
  23.         otherwise rethrow the exception. 
  24.         ------------------------------------------------------------->
  25.         <cfif cfcatch.sqlstate neq 50555>
  26.             <cfrethrow>
  27.         </cfif>
  28.     </cfcatch>
  29.     </cftry>
  30.     
  31. <cfcatch>
  32.     <h3>Sorry, this request can't be completed</h3>
  33.     <h4>Catch variables</h4>
  34.     <cfoutput>
  35.         <cfloop collection=#cfcatch# item="c">
  36.             <br><cfif IsSimpleValue(cfcatch[c])>#c# = #cfcatch[c]#</cfif>
  37.         </cfloop>
  38.     </cfoutput>
  39. </cfcatch>
  40. </cftry>
  41.     
  42. </BODY>
  43. </HTML> 
  44.